package ua.eug.robov2.schematic.chips;

import ua.eug.robov2.schematic.SheetMap;
import ua.eug.robov2.utils.Vector2i;

public class ChipRS extends Chip {
	final static int [][] map = {
		{-1,-1,-1,-1,-1,-1,-1,-1},
		{1,1,0,0,0,0,3,3},
		{-1,1,0,0,0,0,3,-1},
		{1,1,0,0,0,0,3,3},
		{2,2,0,0,0,0,4,4},
		{-1,2,0,0,0,0,4,-1},
		{2,2,0,0,0,0,4,4},
		{-1,-1,-1,-1,-1,-1,-1,-1}
	};
	final static Vector2i[] pinPosS = {
		new Vector2i(1,5),
		new Vector2i(1,2),
		new Vector2i(6,5),
		new Vector2i(6,2)
	};


	public ChipRS () {
		pins = new Pin[4];
		pinPos = pinPosS;
		for (int i=0; i<4; i++) 
			pins[i] = new Pin(0,i);
		chipMap = new SheetMap(map);
		name = "chiprs";
	}

	@Override
	public void act() {
		// TODO
		pins[2].state = pins[0].state | pins[1].state;		
		pins[3].state = pins[0].state | pins[1].state;
	}

}

